From: Florian Müllner Date: Fri, 28 Nov 2025 00:13:29 +0000 (+0100) Subject: layout: Use promise to wait for background to load X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~44^2~59 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=33844025e37be75e47d4a822ceb9f2bea9ba051b;p=gnome-shell.git layout: Use promise to wait for background to load This allows us to separate the end of the loading operation from the steps that follow it. We will soon use that to express the startup animation as a series of (async) steps instead of a chain of function calls. Part-of: --- diff --git a/js/ui/layout.js b/js/ui/layout.js index 170a5d496..4fd23fe32 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -678,6 +678,7 @@ export const LayoutManager = GObject.registerClass({ }); this._systemBackground.add_constraint(constraint); + const {promise, resolve} = Promise.withResolvers(); const signalId = this._systemBackground.connect('loaded', () => { this._systemBackground.disconnect(signalId); @@ -688,13 +689,17 @@ export const LayoutManager = GObject.registerClass({ // This helps to prevent us from running the animation // when the system is bogged down const id = GLib.idle_add(GLib.PRIORITY_LOW, () => { - this._systemBackground.show(); - global.stage.show(); - this._prepareStartupAnimation().catch(logError); + resolve(); return GLib.SOURCE_REMOVE; }); GLib.Source.set_name_by_id(id, '[gnome-shell] Startup Animation'); }); + + await promise; + + this._systemBackground.show(); + global.stage.show(); + this._prepareStartupAnimation().catch(logError); } // Startup Animations